import cn.yunhe.dao.ITopicDao;
import cn.yunhe.entity.Topic;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import java.io.Serializable;
import java.util.List;

public class Demo2 {
    ApplicationContext ac=new ClassPathXmlApplicationContext("applicationContext.xml");
    ITopicDao iTopicDao= (ITopicDao) ac.getBean("topicDao");
    @Test
    public void test(){
        List<Topic>list=iTopicDao.searchAll();
        for (Topic t:list) {
            System.out.println(t);
        }
    }
    @Test
    public void test1(){
        Topic topic=new Topic();
        topic.setTitle("spring");
        List<Topic> list=iTopicDao.searchByKey(topic);
        for (Topic t:list
             ) {
            System.out.println(t);
        }
    }
}
